package com.aliya.glide.module

import android.content.Context
import com.aliya.glide.okhttp.OkHttpUrlLoader
import com.bumptech.glide.Glide
import com.bumptech.glide.Registry
import com.bumptech.glide.annotation.GlideModule
import com.bumptech.glide.load.model.GlideUrl
import com.bumptech.glide.module.LibraryGlideModule
import java.io.InputStream


/**
 * OkHttpLibraryGlideModule
 *
 * @author a_liYa
 * @date 2021/11/1 22:18.
 *
 */
@GlideModule
class OkHttpLibraryGlideModule: LibraryGlideModule() {

    override fun registerComponents(context: Context, glide: Glide, registry: Registry) {
        registry.replace(GlideUrl::class.java, InputStream::class.java, OkHttpUrlLoader.Factory(GlideHelper.okHttpCall))
    }
}